When visit /favicon.ico and the static file is not exist return 404 but not continue to handle the route#14211
Merged
Conversation
…ut not continue to handle the route
Codecov Report
@@ Coverage Diff @@
## master #14211 +/- ##
=======================================
Coverage 42.01% 42.01%
=======================================
Files 734 734
Lines 78773 78773
=======================================
+ Hits 33093 33096 +3
+ Misses 40244 40242 -2
+ Partials 5436 5435 -1
Continue to review full report at Codecov.
|
zeripath
approved these changes
Jan 1, 2021
nuno-silva
approved these changes
Jan 1, 2021
Contributor
nuno-silva
left a comment
There was a problem hiding this comment.
It does indeed fix the problem. Thank you!
Applied the patch to gitea 1.13.1 and set REQUIRE_SIGNIN_VIEW = true:
- before patch:
# curl -sI 127.0.0.1:3000/favicon.ico | grep -E "HTTP|redirect|Location"
HTTP/1.1 302 Found
Location: /user/login
Set-Cookie: redirect_to=%2Ffavicon.ico; Path=/
- after:
# curl -sI 127.0.0.1:3000/favicon.ico | grep -E "HTTP|redirect|Location"
HTTP/1.1 404 Not Found
Note, however, that the issue can still happen if the browser requests some other arbitrary file not listed in KnownPublicEntries (though that's unlikely; can't remember anything right now).
techknowlogick
approved these changes
Jan 1, 2021
Member
|
@lunny please send backport :) |
lunny
added a commit
to lunny/gitea
that referenced
this pull request
Jan 2, 2021
…ut not continue to handle the route (go-gitea#14211) Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This should fix #13771. When requesting a route
/favicon.icoand there is no static file found, a 404 should be given immediately but not continue next middlewares or routes.@nuno-silva could you confirm this fix your problem?